package com.example.gaoyang.util;

import cn.hutool.crypto.Mode;
import cn.hutool.crypto.Padding;
import cn.hutool.crypto.symmetric.AES;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@Slf4j
public class PasswordUtil {

    // 密码加密key
    private static final String KEY = "15faL0zzHytKKKF8";

    // 密码加密iv
    private static final String IV = "3425ccjZ8PgnCPq6";

    /**
     * 密码加密
     * @param password
     * @return
     */
    public static String encipher(String password) {
        AES aes = new AES(Mode.CBC, Padding.PKCS5Padding, KEY.getBytes(), IV.getBytes());
        // 加密并进行Base转码
        return aes.encryptBase64(password);
    }

}
